package com.everflourish.yeah100.entity;

import com.everflourish.yeah100.entity.statistics.ClassSimple;
import com.everflourish.yeah100.utils.DateFormatUtil;
import com.everflourish.yeah100.utils.LogUtil;
import com.everflourish.yeah100.utils.constant.PulishStatus;

import java.io.Serializable;
import java.text.ParseException;
import java.util.List;

public class Examination implements Serializable {

    private static final long serialVersionUID = 9164471489775972799L;

    private String id;
    // 考试名称
    private String name;
    // 科目
    private String subject;
    // 创建时间
    private String date;
    // 发布时间
    private String publishDate;
    // 老师评论
    private String comment;
    // 状态 1:发布，0未发布
    private String status;
    // 状态 N:未统计，Y已统计
    private String statisticTiggered;
    // 考试类型 A卷B卷或者AB卷
    private String paperType = "N";
    // 分享者
    private String sharer;
    //学生成绩录入状态
    private String studentStatus;
    //参加考试的班级
    private List<ClassSimple> classes;
    //主观题录入比较 1，整体录入   2为逐题录入
    private String subjectFlag = "1";
    //最后修改时间
    private String lastModifiedTime;
    //是否是自己创建的考试
    private boolean isSelfCreate = true;

    public boolean isSelfCreate() {
        return isSelfCreate;
    }

    public void setSelfCreate(boolean isSelfCreate) {
        this.isSelfCreate = isSelfCreate;
    }

    public String getSubjectFlag() {
        return subjectFlag;
    }

    public void setSubjectFlag(String subjectFlag) {
        this.subjectFlag = subjectFlag;
    }

    public String getDate() {
        String dateStr = null;
        try {
            dateStr = DateFormatUtil.convertStrToStr(date, "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd E");
        } catch (ParseException e) {
            LogUtil.e("日期转换失败：" + date + " yyyy-MM-dd HH:mm:ss to yyyy-MM-dd E", e);
        }
        return dateStr;
    }

    public void setDate(String date) {
        this.date = date;
    }

    public String getPublishDate() {
        return publishDate;
    }

    public void setPublishDate(String publishDate) {
        this.publishDate = publishDate;
    }

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    public PulishStatus getStatus() {
        if (status == null || status.equals("0")) {
            return PulishStatus.UNPUBLISHED;
        } else {
            return PulishStatus.PUBLISHED;
        }
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getPaperType() {
        return paperType;
    }

    public void setPaperType(String paperType) {
        this.paperType = paperType;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSubject() {
        return subject;
    }

    public void setSubject(String subject) {
        this.subject = subject;
    }

    public String getSharer() {
        return sharer;
    }

    public void setSharer(String sharer) {
        this.sharer = sharer;
    }

    /**
     * @return the studentStatus
     */
    public String getStudentStatus() {
        return studentStatus;
    }

    /**
     * @param studentStatus the studentStatus to set
     */
    public void setStudentStatus(String studentStatus) {
        this.studentStatus = studentStatus;
    }

    public List<ClassSimple> getClasses() {
        return classes;
    }

    public void setClasses(List<ClassSimple> classes) {
        this.classes = classes;
    }

    public String getStatisticTiggered() {
        return statisticTiggered;
    }

    public void setStatisticTiggered(String statisticTiggered) {
        this.statisticTiggered = statisticTiggered;
    }

    /**
     * @return the lastModifiedTime
     */
    public String getLastModifiedTime() {
        return lastModifiedTime;
    }

    /**
     * @param lastModifiedTime the lastModifiedTime to set
     */
    public void setLastModifiedTime(String lastModifiedTime) {
        this.lastModifiedTime = lastModifiedTime;
    }
}
